package com.userautentification.dao.imp;

import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Repository;

import com.userautentification.dao.AddressDao;
import com.userautentification.dao.DataAccessLayerException;
import com.userautentification.entities.Address;

@Repository("addressDao")
public class AddressDaoImp extends GenericDaoHibernate<Address, Long> implements
	AddressDao {

	public AddressDaoImp(Class<Address> address) {
		super(address);

	}

	Log log = LogFactory.getLog(AddressDaoImp.class);

	/**
	 * Insert a new Address into the database.
	 * 
	 * @param addresss
	 */
	public Address save(Address addresss) throws DataAccessLayerException {
		return super.save(addresss);
	}

	/**
	 * Delete a detached Address from the database.
	 * 
	 * @param address
	 */
	public void remove(Address address) throws DataAccessLayerException {
		super.remove(address.getId());
	}

	/**
	 * Updates the state of a detached Address.
	 * 
	 * @param address
	 */
	public void update(Address address) throws DataAccessLayerException {
		super.save(address);
	}

	/**
	 * Finds all Address in the database.
	 * 
	 * @return
	 */
	public List<Address> getAll() throws DataAccessLayerException {
		return super.getAll();
	}

	/**
	 * Finds all distinct Address in the database.
	 * 
	 * @return
	 */
	public List<Address> getAllDistinct() {

		return super.getAllDistinct();

	}

	/**
	 * Finds a Address in the database.
	 * 
	 * @return
	 */
	public Address get(long id) {
		return super.get(id);
	}

	/**
	 * Return true if a Address exist in the database.
	 * 
	 * @return
	 */
	public boolean exists(Long id) {
		return super.exists(id);
	}

	/**
	 * Return a list of Address that exist in the database.
	 * 
	 * @return
	 */
	public List<Address> findByNamedQuery(String queryName,
			Map<String, Object> queryParams) {
		return super.findByNamedQuery(queryName, queryParams);
	}

}